package common

import (
	"context"

	commonTools "algo-sdk-go/common/tools"
	"algo-sdk-go/project/matchmaking/application/dto"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/svc"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type EnumListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewEnumListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EnumListLogic {
	return &EnumListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *EnumListLogic) EnumList(req *types.EnumListRequest) (resp *types.EnumListResponse, err error) {
	/*enumList, err := l.svcCtx.CommonService.LoadEnumList(l.ctx, command.EnumListCommand{
		EnumTypeList: req.EnumTypeList,
	})
	if err != nil {
		logx.Errorf("GetAdEnum_err", "req: %+v", req, "err: %+v", err)
		return nil, err
	}

	resp = &types.EnumListResponse{
		Data: types.EnumListData{
			EnumSceneList: commonTools.Cast(enumList, transEnumScene),
		},
	}*/
	return
}

func transEnumScene(enum dto.EnumScene) types.EnumScene {
	return types.EnumScene{
		Key: enum.Key,
		Values: commonTools.Cast(enum.Values, func(value dto.EnumSceneValue) types.EnumSceneValue {
			return types.EnumSceneValue{
				Label: value.Label,
				Value: value.Value,
			}
		}),
	}
}
